class Solution:
    def findMin(self, nums: list) -> int:
        max_i = len(nums) - 1
        min_i, i = 0, max_i // 2
        if max_i < 30 or (nums[i] == nums[0] and nums[i] == nums[-1]):
            return min(nums)
        while nums[i] >= nums[i-1]:
            if nums[i] < nums[-1]:
                max_i, i = i, (i + min_i) // 2
            elif nums[i] > nums[0]:
                min_i, i = i, (i + max_i) // 2
        return nums[i]


a = Solution()
print(a.findMin([1, 3, 5]))
print(a.findMin([2, 2, 2, 0, 0, 1]))
